cmake_minimum_required(VERSION 3.16)
project(main C CXX)

set(LIBADIR ${PROJECT_SOURCE_DIR}/../libs/build/install/liba)
set(LIBBDIR ${PROJECT_SOURCE_DIR}/../libs/build/install/libb)

add_executable(main main.c)
target_link_libraries(main -L${LIBADIR} -L${LIBBDIR} -lsubb)
# 解决方法：
# 1. target_link_libraries(main -L${LIBADIR} -L${LIBBDIR} -lsubb -lsuba)
#    但是因为main并没有直接调用suba中的函数，所以这样做并不合理
# 2. target_link_libraries(main -L${LIBADIR} -L${LIBBDIR} -lsubb -Wl,-rpath-link=${LIBADIR})